home *** CD-ROM | disk | FTP | other *** search
Text File | 2003-07-17 | 34.8 KB | 1,407 lines |
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: March 5, 2001
- // Author: jdc rendering
- //
-
- global proc string renderCreateBarCB(
- string $as,
- string $flag,
- string $type)
- {
- //
- // Description:
- // This procedure is called when the user presses one of the buttons in
- // the create bar or releases a drag and drop from one of the buttons in
- // the create bar.
- // This procedure calls renderCreateNode() with the arguments necessary to
- // create a node of the type which corresponds to the button.
- // Input arguments to this procedure are as follows:
- //
- // $as: A flag specifying which how to classify the node created.
- // Choices:
- // -as2DTexture: 2d textures
- // -as3DTexture: 3d textures
- // -asEnvTexture: Environment textures
- // -asShader: as a shader
- // -asLight: as a light
- // -asUtility: as a rendering utility node
- //
- // $flag: A secondary flag used to make decisions in combination with
- // $as.
- // Choices:
- // -asBump: defines a created texture as a bump
- // -asNoShadingGroup: for materials; create without a shading
- // group.
- // -asDisplacement: for anything; map the created node
- // to a displacement material.
- // -asUtility: for anything; do whatever the $as flag says,
- // but also classify as a utility
- // -asPostProcess: for any postprocess node
- //
- // $type: The type of node to be created.
- //
- //
- // Returns:
- // The name of the created node.
- //
-
- string $postCommand = "";
- int $projection = (`optionVar -query create2dTextureType` == "projection");
- int $stencil = (`optionVar -query create2dTextureType` == "stencil");
- int $placement = `optionVar -query createTexturesWithPlacement`;
- int $shadingGroup = `optionVar -query createMaterialsWithShadingGroup`;
- int $createAndDrop = 0;
- string $editor = "";
-
- return renderCreateNode(
- $as,
- $flag,
- $type,
- $postCommand,
- $projection,
- $stencil,
- $placement,
- $shadingGroup,
- $createAndDrop,
- $editor);
- }
-
- proc string smallUIName (string $nodeName)
- {
- // In most cases we can just take the given name and
- // add spaces to make it more appealing. For a few
- // larger names we will override the name with a
- // shorter version. This makes the whole window smaller.
- //
- string $labelName;
-
- switch ($nodeName) {
- case "displacementShader":
- $labelName = "Displacement";
- break;
- case "plusMinusAverage":
- $labelName = "+/- Average";
- break;
- case "doubleShadingSwitch":
- $labelName = "Double Switch";
- break;
- case "quadShadingSwitch":
- $labelName = "Quad Switch";
- break;
- case "singleShadingSwitch":
- $labelName = "Single Switch";
- break;
- case "tripleShadingSwitch":
- $labelName = "Triple Switch";
- break;
- case "particleSamplerInfo":
- $labelName = "Particle Sampler";
- break;
- case "surfaceLuminance":
- $labelName = "Surf. Luminance";
- break;
- case "place2dTexture":
- $labelName = "2d Placement";
- break;
- case "place3dTexture":
- $labelName = "3d Placement";
- break;
- default:
- $labelName = interToUI($nodeName);
- break;
- }
-
- return $labelName;
- }
-
- global proc renderCreateBarUIManage(
- string $renderCreateBarUI,
- int $manage)
- {
- //
- // Description:
- // This procedure is called to cause the render create bar UI to be shown
- // or hidden.
- // This procedure causes the formLayout which contains the render create
- // bar UI to be managed or unmanaged, according to the $manage argument.
- //
- formLayout
- -edit
- -manage $manage
- $renderCreateBarUI;
- }
-
- global proc int renderCreateBarUIIsManaged(
- string $renderCreateBarUI)
- {
- //
- // Description:
- // This procedure is called to determine whether or not the create bar UI
- // is being shown.
- //
- // Returns:
- // true if the render create bar UI is shown, false if not.
- //
-
- return (`formLayout -query -manage $renderCreateBarUI`);
- }
-
- proc string tabUIName(
- string $tab)
- {
- //
- // Description:
- // This procedure is called whenever it is necessary to get a user
- // friendly name for one of the create bar tabs, given the name of the tab
- // itself.
- // This procedure associates a user friendly name with the tab name.
- //
- // Returns:
- // The user friendly name.
- //
-
- string $uiName = $tab;
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- if ($style == "iconsAndText")
- {
- if ($tab == "materialsTab")
- {
- $uiName = "Create Materials";
- }
- else if ($tab == "texturesTab")
- {
- $uiName = "Create Textures";
- }
- else if ($tab == "lightsTab")
- {
- $uiName = "Create Lights";
- }
- else if ($tab == "utilitiesTab")
- {
- $uiName = "Create Utilities";
- }
- else if ($tab == "allNodesTab")
- {
- $uiName = "Create All Nodes";
- }
- else if ($tab == "mrNodesTab")
- {
- $uiName = "Create mental ray Nodes";
- }
- else
- {
- // Somebody has added a new tab to the create bar but has not
- // associated it with a user friendly name.
- //
- warning("Create bar tab does not have a corresponding UI name.");
- }
- }
- else // ($style == "iconsAndText")
- {
- if ($tab == "materialsTab")
- {
- $uiName = "Materials";
- }
- else if ($tab == "texturesTab")
- {
- $uiName = "Textures";
- }
- else if ($tab == "lightsTab")
- {
- $uiName = "Lights";
- }
- else if ($tab == "utilitiesTab")
- {
- $uiName = "Utilities";
- }
- else if ($tab == "allNodesTab")
- {
- $uiName = "All";
- }
- else if($tab == "mrNodesTab")
- {
- $uiName = "mr Nodes";
- }
- else
- {
- // Somebody has added a new tab to the create bar but has not
- // associated it with a user friendly name.
- //
- warning("Create bar tab does not have a corresponding UI name.");
- }
- }
-
- return $uiName;
- }
-
- global proc renderCreateBarUIBuildTabChoiceMenu(
- string $tabChoiceButton,
- string $menu)
- //
- // Description:
- // This procedure is called whenever the user clicks on the tab choice
- // button in the render create bar.
- // This procedure builds the menu which appears.
- //
- // Arguments:
- // $tabChoiceButton - The button the popup menu is parented to.
- //
- // $menu - The menu attached to the button.
- //
- {
- setParent -menu $menu;
- menu -edit -deleteAllItems $menu;
-
- string $createBarTabLayout = `setParent createBarTabLayout`;
- string $currentTab = `tabLayout -query -selectTab $createBarTabLayout`;
- string $tabArray[] = `tabLayout -query -childArray $createBarTabLayout`;
-
- radioMenuItemCollection;
-
- for ($i = 0; $i < size($tabArray); $i++)
- {
- // Construct the command the menu item will invoke
- //
- string $cmd =
- ("tabLayout -edit -selectTab "
- + $tabArray[$i]
- + " "
- + $createBarTabLayout
- + "; "
- + "optionVar -stringValue renderCreateBarCurrentTab "
- + $tabArray[$i]
- + "; "
- + "iconTextButton -edit -label \""
- + tabUIName($tabArray[$i])
- + "\" "
- + $tabChoiceButton);
-
- if ("allNodesTab" == $tabArray[$i]) menuItem -divider true;
-
- // Create the menu item
- //
- menuItem
- -enableCommandRepeat false
- -radioButton ($tabArray[$i] == $currentTab)
- -label (tabUIName($tabArray[$i]))
- -command $cmd;
- }
- }
-
- global proc createButtons(
- string $classification,
- string $as,
- string $flag)
- {
- //
- // Description:
- // This procedure is called as the tabs of the render create bar UI are
- // being built.
- // This procedure builds a button for each node type that is classified
- // according to $classification. The button command is configured to
- // create a node of that type using the $as and $flag arguments to
- // renderCreateBarCB().
- //
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- int $dynamicsIsLicensed = `licenseCheck -mode edit -type fx`;
- int $completeLicense = `licenseCheck -mode edit -type complete`;
-
- int $buttonWidth = 350;
- int $buttonHeight = 34;
-
- if ($style == "iconsOnly")
- {
- $buttonWidth = 34;
- }
-
- columnLayout -adjustableColumn true /* createButtonColumn */;
-
- string $nodes[] = `listNodeTypes $classification`;
-
- for ($type in $nodes)
- {
- string $labelName = smallUIName($type);
-
- string $command =
- ("renderCreateBarCB "
- + $as
- + " \""
- + $flag
- + "\" "
- + $type);
-
- string $buttonStyle, $annotation;
- if ($style == "iconsAndText") {
- // Specify that the button should display icon and text, and
- // that it should not have an annotation
- //
- $buttonStyle = "iconAndTextHorizontal";
- $annotation = "";
-
- } else /* ($style == "iconsOnly") */ {
- $buttonStyle = "iconOnly";
- $annotation = $labelName;
- }
-
- nodeIconButton
- -width $buttonWidth
- -height $buttonHeight
- -label (" " + $labelName)
- -image1 ("render_" + $type + ".xpm")
- -style $buttonStyle
- -annotation $annotation
- -command $command
- ("createBar" + $type + "Button");
-
- if( (!$dynamicsIsLicensed)
- && ( ($type == "particleCloud")
- || ($classification == "utility/particle")))
- {
- // The node is a particle node, but the user does not have a
- // license for dynamics. We will disable the button for the
- // node.
- //
- nodeIconButton
- -edit
- -enable false
- ("createBar" + $type + "Button");
- }
-
- if ( (!$completeLicense)
- && ($classification == "imageplane"))
- {
- // The node is a image plane, but the user does not have a
- // license for complete. We will disable the button for the
- // node.
- //
- nodeIconButton
- -edit
- -enable false
- ("createBar" + $type + "Button");
- }
- }
-
- setParent ..; // from createButtonColumn
- }
-
- global proc renderCreateBarUICollapse(
- string $frame,
- string $button)
- {
- //
- // Description:
- // This method is called when the render create bar is being displayed in
- // icons only mode and the user has clicked on the collapse separator of a
- // section of buttons.
- // This method collapses or expands the specified frame (which contains
- // the buttons directly below the collapse separator) and updates the icon
- // on the button appropriately.
- //
-
- // Collapse or expand the frame layout
- //
- int $collapse = !(`frameLayout -query -collapse $frame`);
-
- frameLayout
- -edit
- -collapse $collapse
- $frame;
-
- // Update the image on the button
- //
- string $image;
-
- if ($collapse)
- {
- $image = "closeBarHorizontal.xpm";
- }
- else
- {
- $image = "openBarHorizontal.xpm";
- }
-
- iconTextButton
- -edit
- -image1 $image
- $button;
- }
-
- proc string createCollapseButton()
- {
- //
- // Description:
- // This procedure is called when the UI in a tab of the create bar is
- // being created.
- // This procedure creates a collapse separator button if and only if the
- // render create bar is in icons only mode. Otherwise this procedure does
- // nothing.
- //
- // Returns:
- // The name of the button that is created.
- //
-
- string $button;
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- if ($style == "iconsOnly")
- {
- $button =
- `iconTextButton
- -width 26
- -height 9
- -image1 "closeBarHorizontal.xpm"`;
- }
-
- return $button;
- }
-
- proc setCollapseButtonFrame(
- string $button,
- string $frame)
- {
- //
- // Description:
- // This procedure is called when the UI in a tab of the create bar is
- // being created.
- // This procedure associates the specified frame layout with the specified
- // collapse separator button. This allows the button to know which frame
- // to collapse/expand when pressed and what icon to initially display on
- // the button.
- //
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- if ($style == "iconsOnly")
- {
- // Determine the initial image of the button from the current
- // collapse/expand state of the frame layout
- //
- int $collapsed = `frameLayout -query -collapse $frame`;
- string $annotation = `frameLayout -query -label $frame`;
-
- string $image;
-
- if ($collapsed)
- {
- $image = "closeBarHorizontal.xpm";
- }
- else
- {
- $image = "openBarHorizontal.xpm";
- }
-
- // Set the image, annotation and command of the button
- //
- iconTextButton
- -edit
- -image1 $image
- -annotation $annotation
- -command
- ("renderCreateBarUICollapse " + $frame + " " + $button)
- $button;
- }
- }
-
- global proc string createCollapseGroup(
- string $label,
- int $labelVisible,
- int $borderVisible,
- int $collapsed)
- //
- // Description:
- // Create the collapse mechanism for a group of controls.
- //
- // Currently, this is simply a collapsable frame Layout.
- //
- // Arguments:
- // label - The label for the group.
- //
- // labelVisible - True if the label should be made visible.
- //
- // borderVisible - True if the frame border should be made visible.
- //
- // collapsed - True if the group should be collapsed.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- string $button, $frame;
-
- $button = createCollapseButton();
- if(`about -mac`){
- string $style = `optionVar -query renderCreateBarStyle`;
-
- if ($style == "iconsOnly"){
- $frame = `frameLayout
- -label $label
- -borderVisible $borderVisible
- -width 40
- -labelVisible $labelVisible
- -collapsable true
- -borderStyle "etchedIn"
- -marginWidth 0
- -marginHeight 5
- -collapse $collapsed
- `;
- }else{
- $frame = `frameLayout
- -label $label
- -borderVisible $borderVisible
- -labelVisible $labelVisible
- -collapsable true
- -borderStyle "etchedIn"
- -marginWidth 0
- -marginHeight 5
- -collapse $collapsed
- `;
- }
- }else{
-
- $frame = `frameLayout
- -label $label
- -borderVisible $borderVisible
- -labelVisible $labelVisible
- -collapsable true
- -borderStyle "etchedIn"
- -marginWidth 0
- -marginHeight 5
- -collapse $collapsed
- `;
- }
-
- setCollapseButtonFrame($button, $frame);
-
- return $frame;
- }
-
- proc string createSurfaceMaterials(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Surface Materials group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Surface", $labelVisible, $borderVisible, false);
- }
-
- proc string createVolumetricMaterials(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Volumetric Materials group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Volumetric", $labelVisible, $borderVisible, true);
- }
-
- proc string createDisplacementMaterials(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Displacement Materials group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Displacement", $labelVisible, $borderVisible, true);
- }
-
- proc createMaterialsTab()
- {
- //
- // Description:
- // This procedure is called as the UI is being created.
- // This procedure creates the contents of the Materials tab.
- //
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- int $borderVisible = true;
- int $labelVisible = true;
-
- if ($style == "iconsOnly")
- {
- $borderVisible = false;
- $labelVisible = false;
- }
-
- scrollLayout materialsTab;
-
- columnLayout -adjustableColumn true /* materialsTabColumn */;
-
- createSurfaceMaterials($labelVisible, $borderVisible);
- createButtons("shader/surface", "-asShader", "surfaceShader");
- setParent ..;
-
- createVolumetricMaterials($labelVisible, $borderVisible);
- createButtons("shader/volume", "-asShader", "volumeShader");
- setParent ..;
-
- createDisplacementMaterials($labelVisible, $borderVisible);
- createButtons("shader/displacement", "-asShader", "displacementShader");
- setParent ..;
-
- setParent ..; // from materialsTabColumn
-
- setParent ..; // from materialsTab
- }
-
- proc string create2DTextures(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the 2D Textures group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("2D Textures", $labelVisible, $borderVisible, false);
- }
-
- proc string create3DTextures(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the 3D Textures group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("3D Textures", $labelVisible, $borderVisible, false);
- }
-
- proc string createEnvironmentTextures(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Environment Textures group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Env Textures", $labelVisible, $borderVisible, true);
- }
-
- proc string createOtherTextures(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Other Textures group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Other Textures", $labelVisible, $borderVisible, false);
- }
-
- proc createTexturesTab()
- {
- //
- // Description:
- // This procedure is called as the UI is being created.
- // This procedure creates the contents of the Textures tab.
- //
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- int $borderVisible = true;
- int $labelVisible = true;
-
- if ($style == "iconsOnly")
- {
- $borderVisible = false;
- $labelVisible = false;
- }
-
- scrollLayout texturesTab;
-
- columnLayout -adjustableColumn true /* texturesTabColumn */;
-
- create2DTextures($labelVisible, $borderVisible);
-
- columnLayout
- -adjustableColumn true
- /* texture2dOptionsAndButtonsColumn */;
- radioCollection;
-
- radioButton -label "Normal"
- -align "left"
- -onCommand ("optionVar "
- + "-stringValue create2dTextureType \"normal\";"
- + "refreshCreateNodeUI();")
- normalRadioBtn;
-
- radioButton -label "As projection"
- -align "left"
- -onCommand ("optionVar "
- + "-stringValue create2dTextureType \"projection\";"
- + "refreshCreateNodeUI();")
- projectionRadioBtn;
-
- radioButton -label "As stencil"
- -align "left"
- -onCommand ("optionVar "
- + "-stringValue create2dTextureType \"stencil\";"
- + "refreshCreateNodeUI();")
- stencilRadioBtn;
-
- if ($style == "iconsOnly") {
- radioButton -edit
- -label "N"
- -annotation "Normal"
- normalRadioBtn;
- radioButton -edit
- -label "P"
- -annotation "Projection"
- projectionRadioBtn;
- radioButton -edit
- -label "S"
- -annotation "Stencil"
- stencilRadioBtn;
- }
-
- if (`optionVar -query create2dTextureType` == "normal") {
- radioButton -edit -select normalRadioBtn;
-
- } else if (`optionVar -query create2dTextureType` == "projection") {
- radioButton -edit -select projectionRadioBtn;
-
- } else { // (`optionVar -query create2dTextureType` == "stencil")
- radioButton -edit -select stencilRadioBtn;
- }
-
- separator -style "none" -height 5;
-
- createButtons("texture/2d", "-as2DTexture", "");
- setParent ..;
- setParent ..;
-
- create3DTextures($labelVisible, $borderVisible);
- createButtons("texture/3d", "-as3DTexture", "");
- setParent ..;
-
- createEnvironmentTextures($labelVisible, $borderVisible);
- createButtons("texture/environment", "-asEnvTexture", "");
- setParent ..;
-
- createOtherTextures($labelVisible, $borderVisible);
- createButtons("texture/other", "-asTexture", "");
- setParent ..;
-
- setParent ..; // from texturesTabColumn
- setParent ..; // from texturesTab
- }
-
- proc string createLights(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Lights group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Lights", $labelVisible, $borderVisible, false);
- }
-
- proc createLightsTab()
- {
- //
- // Description:
- // This procedure is called as the UI is being created.
- // This procedure creates the contents of the Lights tab.
- //
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- int $borderVisible = true;
- int $labelVisible = true;
-
- if ($style == "iconsOnly")
- {
- $borderVisible = false;
- $labelVisible = false;
- }
-
- scrollLayout lightsTab;
-
- columnLayout -adjustableColumn true /* lightsTabColumn */;
-
- createLights($labelVisible, $borderVisible);
- createButtons("light", "-asLight", "");
- setParent ..;
-
- setParent ..; // from lightsTabColumn
-
- setParent ..; // from lightsTab
- }
-
- proc string createGeneralUtilities(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the General Utilities group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("General Utilities", $labelVisible, $borderVisible, false);
- }
-
- proc string createColorUtilities(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Color Utilities group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Color Utilities", $labelVisible, $borderVisible, false);
- }
-
- proc string createSwitchUtilities(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Switch Utilities group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Switch Utilities", $labelVisible, $borderVisible, true);
- }
-
- proc string createParticleUtilities(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Particle Utilities group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Particle Utilities", $labelVisible, $borderVisible, true);
- }
-
- proc string createImagePlanes(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Image Planes group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Image Planes", $labelVisible, $borderVisible, true);
- }
-
- proc string createGlow(int $labelVisible, int $borderVisible)
- //
- // Description:
- // Create the Glow group.
- //
- // Returns:
- // The full path name of the layout control created.
- //
- {
- return createCollapseGroup("Glow", $labelVisible, $borderVisible, true);
- }
-
- proc createUtilitiesTab()
- {
- //
- // Description:
- // This procedure is called as the UI is being created.
- // This procedure creates the contents of the Utilities tab.
- //
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- int $borderVisible = true;
- int $labelVisible = true;
-
- if ($style == "iconsOnly")
- {
- $borderVisible = false;
- $labelVisible = false;
- }
-
- scrollLayout utilitiesTab;
-
- columnLayout -adjustableColumn true /* utilitiesTabColumn */;
-
- createGeneralUtilities($labelVisible, $borderVisible);
- createButtons("utility/general", "-asUtility", "");
- setParent ..;
-
- createColorUtilities($labelVisible, $borderVisible);
- createButtons("utility/color", "-asUtility", "");
- setParent ..;
-
- createSwitchUtilities($labelVisible, $borderVisible);
- createButtons("utility/switch", "-asUtility", "");
- setParent ..;
-
- createParticleUtilities($labelVisible, $borderVisible);
- createButtons("utility/particle", "-asUtility", "");
- setParent ..;
-
- createImagePlanes($labelVisible, $borderVisible);
- createButtons("imageplane", "-asUtility", "");
- setParent ..;
-
- createGlow($labelVisible, $borderVisible);
- createButtons("postprocess/opticalFX", "-asPostProcess", "");
- setParent ..;
-
- setParent ..; // from utilitiesTabColumn
- setParent ..; // from utilitiesTab
- }
-
- proc createAllNodesTab()
- //
- // Description:
- // This procedure is called as the UI is being created.
- // This procedure creates the contents of the Utilities tab.
- //
- {
- string $style = `optionVar -query renderCreateBarStyle`;
-
- int $borderVisible = true;
- int $labelVisible = true;
-
- if ($style == "iconsOnly")
- {
- $borderVisible = false;
- $labelVisible = false;
- }
-
- string $frame;
- string $button;
-
- scrollLayout allNodesTab;
-
- columnLayout -adjustableColumn true /* allNodesTabColumn */;
-
- // Materials.
- //
- createSurfaceMaterials($labelVisible, $borderVisible);
- createButtons("shader/surface", "-asShader", "surfaceShader");
- setParent ..;
-
- createVolumetricMaterials($labelVisible, $borderVisible);
- createButtons("shader/volume", "-asShader", "volumeShader");
- setParent ..;
-
- createDisplacementMaterials($labelVisible, $borderVisible);
- createButtons("shader/displacement", "-asShader", "displacementShader");
- setParent ..;
-
- // Textures.
- //
- create2DTextures($labelVisible, $borderVisible);
-
- columnLayout
- -adjustableColumn true
- /* texture2dOptionsAndButtonsColumn */;
-
- radioCollection;
-
- radioButton -label "Normal"
- -align "left"
- -onCommand ("optionVar "
- + "-stringValue create2dTextureType \"normal\";"
- + "refreshCreateNodeUI();")
- normalRadioBtn2;
-
- radioButton -label "As Projection"
- -align "left"
- -onCommand ("optionVar "
- + "-stringValue create2dTextureType \"projection\";"
- + "refreshCreateNodeUI();")
- projectionRadioBtn2;
-
- radioButton -label "As Stencil"
- -align "left"
- -onCommand ("optionVar "
- + "-stringValue create2dTextureType \"stencil\";"
- + "refreshCreateNodeUI();")
- stencilRadioBtn2;
-
- if ($style == "iconsOnly") {
- radioButton -edit
- -label "N"
- -annotation "Normal"
- normalRadioBtn2;
- radioButton -edit
- -label "P"
- -annotation "Projection"
- projectionRadioBtn2;
- radioButton -edit
- -label "S"
- -annotation "Stencil"
- stencilRadioBtn2;
- }
-
- if (`optionVar -query create2dTextureType` == "normal") {
- radioButton -edit -select normalRadioBtn2;
-
- } else if (`optionVar -query create2dTextureType` == "projection") {
- radioButton -edit -select projectionRadioBtn2;
-
- } else { // (`optionVar -query create2dTextureType` == "stencil")
- radioButton -edit -select stencilRadioBtn2;
- }
-
- separator -style "none" -height 5;
-
- createButtons("texture/2d", "-as2DTexture", "");
- setParent ..;
- setParent ..;
-
- create3DTextures($labelVisible, $borderVisible);
- createButtons("texture/3d", "-as3DTexture", "");
- setParent ..;
-
- createEnvironmentTextures($labelVisible, $borderVisible);
- createButtons("texture/environment", "-asEnvTexture", "");
- setParent ..;
-
- createOtherTextures($labelVisible, $borderVisible);
- createButtons("texture/other", "-asTexture", "");
- setParent ..;
-
- // Lights.
- //
- createLights($labelVisible, $borderVisible);
- createButtons("light", "-asLight", "");
- setParent ..;
-
- // Utilities.
- //
- createGeneralUtilities($labelVisible, $borderVisible);
- createButtons("utility/general", "-asUtility", "");
- setParent ..;
-
- createColorUtilities($labelVisible, $borderVisible);
- createButtons("utility/color", "-asUtility", "");
- setParent ..;
-
- createSwitchUtilities($labelVisible, $borderVisible);
- createButtons("utility/switch", "-asUtility", "");
- setParent ..;
-
- createParticleUtilities($labelVisible, $borderVisible);
- createButtons("utility/particle", "-asUtility", "");
- setParent ..;
-
- createImagePlanes($labelVisible, $borderVisible);
- createButtons("imageplane", "-asUtility", "");
- setParent ..;
-
- createGlow($labelVisible, $borderVisible);
- createButtons("postprocess/opticalFX", "-asPostProcess", "");
- setParent ..;
-
- setParent ..; // from allNodesTabColumn
- setParent ..; // from allNodesTab
- }
-
- global proc renderCreateBarUIRefresh(
- string $renderCreateBarUI)
- {
- //
- // Description:
- // This procedure is called when the state of Maya has changed in a way
- // that requires the create bar UI to be updated to reflect the new state.
- // For now, the only thing this procedure does is ensure that the radio
- // buttons in the textures tab are in sync with the option var dictating
- // how 2d textures should be created (normal/projection/stencil).
- //
-
- // Remember the current parent so we can revert to it when we're done here.
- //
- string $oldParent = `setParent -query`;
- string $oldMenuParent = `setParent -menu -query`;
-
- // Ensure the proper radio button is selected in the
- // normal/projection/stencil radio button collection in the textures tab.
- //
- setParent $renderCreateBarUI;
- setParent texturesTab;
-
- if (`optionVar -query create2dTextureType` == "normal")
- {
- radioButton -edit -select normalRadioBtn;
- radioButton -edit -select normalRadioBtn2;
-
- }
- else if (`optionVar -query create2dTextureType` == "projection")
- {
- radioButton -edit -select projectionRadioBtn;
- radioButton -edit -select projectionRadioBtn2;
-
- }
- else // (`optionVar -query create2dTextureType` == "stencil")
- {
- radioButton -edit -select stencilRadioBtn;
- radioButton -edit -select stencilRadioBtn2;
- }
-
- // Revert to the original parent.
- //
- setParent $oldParent;
- if ($oldMenuParent != "NONE") setParent -menu $oldMenuParent;
- }
-
- global proc string renderCreateBarUI(
- string $parentForm)
- {
- //
- // Description:
- // This procedure is called to build the UI on the left of the Hypershade
- // panel which allows the user to create new render nodes.
- //
- // Returns:
- // The name of the renderCreateBarUI that has been created. This name
- // should be stored and used later as an argument to other procedures in
- // this file which require it.
- //
-
- // Initialize optionVars if they do not yet exist
- //
- if (!`optionVar -exists renderCreateBarStyle`)
- {
- optionVar -stringValue renderCreateBarStyle "iconsAndText";
- }
- if (!`optionVar -exists renderCreateBarCurrentTab`)
- {
- optionVar -stringValue renderCreateBarCurrentTab "texturesTab";
- }
-
- string $style = `optionVar -query renderCreateBarStyle`;
-
- setParent $parentForm;
-
- string $renderCreateBarUI = `formLayout renderCreateBar`;
-
- string $tabChoiceFrame =
- `frameLayout
- -labelVisible false
- -collapsable false
- -borderStyle "out"`;
-
- string $tabChoiceButton = `iconTextButton
- -image1 "shelfOptions.xpm"
- -annotation "Choose which type of node to create"
- -height 20`;
-
- setParent ..;
-
- if ($style == "iconsAndText") {
- iconTextButton -edit -style "iconAndTextHorizontal" $tabChoiceButton;
- } else /* ($style == "iconsOnly") */ {
- iconTextButton -edit -style "textOnly" $tabChoiceButton;
- }
-
- // Create the popup menu from which the user can choose the type of
- // nodes to create in the create bar
- //
- // Put the popup menu on both the left and right mouse buttons.
- // By putting on the right mouse button the user will get a
- // cursor change that indicates a popup menu is attached there.
- //
- string $menu = `popupMenu -button 1 -parent $tabChoiceButton`;
- menu
- -edit
- -postMenuCommand
- ("renderCreateBarUIBuildTabChoiceMenu "
- + $tabChoiceButton
- + " "
- + $menu)
- $menu;
-
- $menu = `popupMenu -button 3 -parent $tabChoiceButton`;
- menu
- -edit
- -postMenuCommand
- ("renderCreateBarUIBuildTabChoiceMenu "
- + $tabChoiceButton
- + " "
- + $menu)
- $menu;
-
- if (`about -os` == "nt")
- {
- frameLayout
- -labelVisible false
- -collapsable false
- -borderStyle "in"
- tabFrame;
- }
-
- // Create the tab layout which contains all of the node creation UI
- //
- tabLayout
- -tabsVisible false
- createBarTabLayout;
-
- // Define a template for scrollLayout which will be used when
- // creating the scrollLayouts inside of each of the following tabs.
- //
- if (!`uiTemplate -exists renderCreateBarTemplate`)
- {
- uiTemplate renderCreateBarTemplate;
-
- scrollLayout
- -defineTemplate renderCreateBarTemplate
- -horizontalScrollBarThickness 0
- -verticalScrollBarThickness 16;
- }
-
- setUITemplate -pushTemplate renderCreateBarTemplate;
-
- createMaterialsTab();
- createTexturesTab();
- createLightsTab();
- createUtilitiesTab();
-
- int $showMentalRayCustomShaders = 0;
- int $mentalRayPluginLoaded = 0;
-
- if (`getenv MAYA_MRFM_SHOW_CUSTOM_SHADERS` == "1")
- {
- $showMentalRayCustomShaders = 1;
- }
-
- if (`pluginInfo -query -loaded Mayatomr`)
- {
- $mentalRayPluginLoaded = 1;
- }
-
- if ($showMentalRayCustomShaders && $mentalRayPluginLoaded)
- {
- mrRenderCreateBar_CreateTab();
- }
-
- createAllNodesTab();
-
- setUITemplate -popTemplate;
-
- tabLayout
- -edit
- -tabLabel materialsTab "Materials"
- -tabLabel texturesTab "Textures"
- -tabLabel lightsTab "Lights"
- -tabLabel utilitiesTab "Utilities"
- -tabLabel allNodesTab "All Nodes"
- createBarTabLayout;
-
- if ($showMentalRayCustomShaders && $mentalRayPluginLoaded)
- {
- tabLayout
- -edit
- -tabLabel mrNodesTab "mental ray Nodes"
- createBarTabLayout;
- }
-
- // Determine the current tab and set the contents of the create
- // bar and the label of the tab choice button to reflect it.
- //
- string $currentTab =
- (`optionVar -query renderCreateBarCurrentTab`);
-
- if (!`layout -exists $currentTab`)
- {
- $currentTab = "materialsTab";
- }
-
- string $label = tabUIName($currentTab);
-
- iconTextButton
- -edit
- -label $label
- $tabChoiceButton;
-
- tabLayout
- -edit
- -selectTab $currentTab
- createBarTabLayout;
-
- setParent ..; // from createBarTabs
-
- if (`about -os` == "nt")
- {
- setParent ..; // from tabFrame
-
- formLayout
- -edit
- -af $tabChoiceFrame top 0
- -an $tabChoiceFrame bottom
- -af $tabChoiceFrame left 0
- -af $tabChoiceFrame right 0
-
- -ac tabFrame top 1 $tabChoiceFrame
- -af tabFrame bottom 0
- -af tabFrame left 0
- -af tabFrame right 0
- $renderCreateBarUI;
- }
- else
- {
- formLayout
- -edit
- -af $tabChoiceFrame top 0
- -an $tabChoiceFrame bottom
- -af $tabChoiceFrame left 0
- -af $tabChoiceFrame right 0
-
- -ac createBarTabLayout top 0 $tabChoiceFrame
- -af createBarTabLayout bottom 0
- -af createBarTabLayout left 0
- -af createBarTabLayout right 0
- $renderCreateBarUI;
- }
-
- setParent ..; // from $renderCreateBarUI
-
- formLayout
- -edit
- -af $renderCreateBarUI top 0
- -af $renderCreateBarUI bottom 0
- -af $renderCreateBarUI left 0
- -af $renderCreateBarUI right 0
- $parentForm;
-
- return $renderCreateBarUI;
- }
-